/*
 * Copyright (C) 2012  Romain DUBOIS
 * 
 * This file is part of NeMoS - Network and Modular Software
 * 
 * NeMoS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * NeMoS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with NeMoS.  If not, see <http://www.gnu.org/licenses/>.
 */
package nemos.swing;

import java.awt.LayoutManager;
import java.util.Map;

/**
 * ILayoutFactory : The layout factory interface.
 * 
 * <p>
 * Services registered under this interface provide Swing {@link LayoutManager}
 * s. The managed layout type must be registered in the {@link #LAYOUT_TYPE}
 * service property.
 * </p>
 * 
 * <p>
 * This interface main purpose is to ease the generation of Swing interfaces
 * from external resources, mainly textual files (plain, XML, ...). This is why
 * a {@link ILayoutFactory} should handle parameters in a single {@link String}
 * form.
 * </p>
 * 
 * @author Romain DUBOIS
 */
public interface ILayoutFactory {

    /** The managed layout property name (String property) */
    String LAYOUT_TYPE = "nemos.swing.layout.type"; //$NON-NLS-1$

    /**
     * Create a layout in its default form.
     * 
     * @return A layout
     */
    LayoutManager createLayout();

    /**
     * Create a layout using the specified parameters.
     * 
     * @param pParams
     *            The parameters in a single String
     * @return A layout
     */
    LayoutManager createLayout(String pParams);

    /**
     * Create a layout using the specified parameters.
     * 
     * @param pParams
     *            The parameters map
     * @return A layout
     */
    LayoutManager createLayout(Map<String, ?> pParams);

    /**
     * Create a layout constraints object from its {@link String} form.
     * 
     * @param pString
     *            The constraints description
     * @return The constraints object
     */
    Object getConstraints(String pString);

    /**
     * Create a layout constraints object from a constraints map.
     * 
     * @param pMap
     *            The constraints map
     * @return The constraints object
     */
    Object getConstraints(Map<String, ?> pMap);
}
